<template>
  <div id="app">
    <School></School>
<!--    父组件中定义时间监听方式-->
<!--    第一种方式-->
<!--    <Student @sendname="getSendName"></Student>-->
<!--    第二种方式-->
<!--    <Student v-on:sendname="getSendName"></Student>-->
<!--    第三种方式-->
    <Student ref="demo"></Student>
  </div>
</template>

<script>
import School from './components/School'
import Student from './components/Student'

export default {
  name: 'App',
  components: {
    School,
    Student
  },
  methods: {
    getSendName(name) {
      console.log('App接收到的数据')
      console.log(name)
    }
  },
  mounted() {
    this.$refs.demo.$on('sendname',this.getSendName)
  }
}
</script>

<style>
</style>
